/*
    34. Write a C programming to convert vowels into upper case character in a given string. 
    Test Data :
    Input a string : w3resource
    Expected Output:

    Input a sentence: The original string:
    w3resource
    After converting vowels into upper case the sentence becomes:
    w3rEsOUrcE
*/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

char* getstr(char *str)
{
    char ch;
    char *p = str;
    while((ch = getchar()) != '\n'){
        *p++ = ch;
    }
    *p = '\0';
    return str;
}

int isvow(char ch)
{
    char lowervow[5] = {'a', 'e', 'i', 'o', 'u'};
    for(int i = 0; i < 5; i++){
        if(ch == lowervow[i])
            return 1;
    }
    return 0;
}

void cvtvowupper(char *str)
{
    while(*str){
        if(isvow(*str)){
            *str = *str - 32;
        }
        str++;
    }
}

int main(void)
{
    char *str = malloc(1024);
    printf("Input a string : ");
    getstr(str);
    cvtvowupper(str);
    printf("After converting vowels into upper case the sentence becomes: \n%s", str);

    return 0;
}